package org.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.example.entity.UserProject;

import java.util.List;

public interface UserprojectMapper extends BaseMapper<UserProject> {
    @Select("SELECT * FROM userProject WHERE userName = #{userName} and states='通过'")
    List<UserProject> selcetUserProject(String userName);
    @Select("SELECT projectName FROM userProject WHERE userName = #{username} and states=#{s}")
    List<String> selectUserProject2(@Param("username") String username,@Param("s") String s);
    @Select("SELECT * FROM userProject WHERE userName = #{username} and states=#{s} and projectName=#{projectName}")
    UserProject existsByProjectNameAndUserNameAndStates(String projectName, String username, @Param("s") String s);
    @Select("SELECT * FROM userProject WHERE privilege=0 and projectName=#{projectName}")
    List<UserProject> selectprojectstudent(String projectName);
    @Update("UPDATE userProject SET states= '通过' WHERE projectName=#{projectName}")
    void updatestate(String projectName);
    @Select("SELECT * FROM userProject WHERE userName=#{name} and projectName=#{projectName}")
    List<UserProject> selectprojectstudentss(@Param("projectName") String projectName,@Param("name") String name);
}
